package chapter10;

import java.util.Scanner;

public class SalaryDemo {

    public static void main(String[] args) {
        Scanner sc= new Scanner(System.in);


        double[] salarys=new double[5];
        System.out.println("请输入5位员工的工资");

        for (int i=0;i< salarys.length;i++){
            salarys[i]=sc.nextDouble();
        }
        System.out.println("请输入员工的序号（1-5）");
        int num=sc.nextInt();

        System.out.println("请输入你要提高工资的金额");

        double money=sc.nextDouble();

        int index=num-1;

        if(num> salarys.length){
            System.out.println("你输入的学号不正确");
            return;
        }else {
            if(money> salarys[index]*0.2){
                salarys[index]=salarys[index]*1.2;
            }else{
                salarys[index]+=money;
            }
        }
        System.out.println(num+"号员工提薪后的工资为"+salarys[index]);

    }
}
